package design.simdi.code.final_paper.site.panels.licente;

import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.TabbedPanel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;

import design.simdi.code.final_paper.site.panels.PageContentPanel;
import design.simdi.code.final_paper.site.panels.licente.admisi.AdmisiTabPanel;
import design.simdi.code.final_paper.site.panels.licente.candidati.CandidatiTabPanel;
import design.simdi.code.final_paper.site.panels.licente.domenii.DomeniiTabPanel;
import design.simdi.code.final_paper.site.panels.licente.proiecte.ProiecteTabPanel;

/**
 * 
 * @author Marius Dumitriu - (Jun 8, 2010 - 2:15:21 AM)
 * 
 */
public class LicentePageContentPanel extends PageContentPanel {

	private static final long serialVersionUID = 1L;

	@SuppressWarnings("unchecked")
	private List tabs;

	public LicentePageContentPanel(String id) {
		super(id);
	}

	public LicentePageContentPanel(String id, IModel<?> model) {
		super(id, model);
	}

	@SuppressWarnings("unchecked")
	@Override
	public void panelInit() {
		setOutputMarkupId(true);
		tabs = new ArrayList<AbstractTab>();

		tabs.add(new AbstractTab(new ResourceModel("domenii")) {

			private static final long serialVersionUID = 1L;

			public Panel getPanel(String panelId) {
				return new DomeniiTabPanel(panelId);
			}

		});

		tabs.add(new AbstractTab(new ResourceModel("proiecte")) {

			private static final long serialVersionUID = 1L;

			public Panel getPanel(String panelId) {
				return new ProiecteTabPanel(panelId);
			}

		});

		// Roles roluriCurente = MyAuthenticatedWebSession.get().getRoles();
		// if (MyAuthenticatedWebSession.get().isSignedIn()
		// && (roluriCurente.contains(ApplicationRoles.PROFESSOR)
		// || roluriCurente.contains(ApplicationRoles.STUDENT) || roluriCurente
		// .contains(ApplicationRoles.ABSOLVENT))) {
		tabs.add(new AbstractTab(new ResourceModel("candidati")) {

			private static final long serialVersionUID = 1L;

			public Panel getPanel(String panelId) {
				return new CandidatiTabPanel(panelId);
			}

		});

		tabs.add(new AbstractTab(new ResourceModel("admisi")) {

			private static final long serialVersionUID = 1L;

			public Panel getPanel(String panelId) {
				return new AdmisiTabPanel(panelId);
			}

		});

		// }
		add(new TabbedPanel("tabs", tabs));
	}
}
